Skip to content

Prevent panic on git blame by limiting lines to 4096 bytes at most#13470

Merged
techknowlogick merged 3 commits into
go-gitea:masterfrom
zeripath:fix-12440-prevent-panic-on-git-blame
Nov 10, 2020
Merged

Prevent panic on git blame by limiting lines to 4096 bytes at most#13470
techknowlogick merged 3 commits into
go-gitea:masterfrom
zeripath:fix-12440-prevent-panic-on-git-blame

Conversation

@zeripath
Copy link
Copy Markdown
Contributor

@zeripath zeripath commented Nov 8, 2020

This PR prevents the panic by limiting the number of bytes per line to 4096 bytes (The default buffer size for a reader)

Fix #12440
Closes #13192

Signed-off-by: Andrew Thornton art27@cantab.net

Fix go-gitea#12440
Closes go-gitea#13192

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Copy Markdown
Contributor Author

zeripath commented Nov 8, 2020

There is a potentially nicer solution here - limit the lines to 1024 or possibly a fewer number of runes and create an expansion button. However this PR presents the simplest fix to prevent the panic.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 8, 2020
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 9, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 9, 2020
@6543
Copy link
Copy Markdown
Member

6543 commented Nov 9, 2020

works nicely

@6543
Copy link
Copy Markdown
Member

6543 commented Nov 9, 2020

@6543 6543 added the backport/done All backports for this PR have been created label Nov 9, 2020
@6543
Copy link
Copy Markdown
Member

6543 commented Nov 10, 2020

🚀

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #13470 (eea6584) into master (77e5081) will increase coverage by 0.13%.
The diff coverage is 52.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13470      +/-   ##
==========================================
+ Coverage   42.05%   42.19%   +0.13%     
==========================================
  Files         694      694              
  Lines       76334    76347      +13     
==========================================
+ Hits        32105    32212     +107     
+ Misses      38971    38857     -114     
- Partials     5258     5278      +20     
Impacted Files Coverage Δ
modules/git/blame.go 65.71% <52.38%> (-9.73%) ⬇️
modules/log/event.go 58.96% <0.00%> (-0.95%) ⬇️
models/gpg_key.go 53.33% <0.00%> (-0.58%) ⬇️
models/error.go 35.72% <0.00%> (+0.50%) ⬆️
services/pull/pull.go 41.27% <0.00%> (+0.98%) ⬆️
services/mailer/mail.go 61.29% <0.00%> (+1.07%) ⬆️
models/repo_language_stats.go 63.47% <0.00%> (+1.73%) ⬆️
services/pull/check.go 51.09% <0.00%> (+2.18%) ⬆️
modules/notification/notification.go 86.60% <0.00%> (+2.67%) ⬆️
modules/notification/base/null.go 77.14% <0.00%> (+2.85%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77e5081...eea6584. Read the comment docs.

@techknowlogick
Copy link
Copy Markdown
Member

🚀

@techknowlogick techknowlogick merged commit 182b5a0 into go-gitea:master Nov 10, 2020
techknowlogick added a commit to techknowlogick/gitea that referenced this pull request Nov 10, 2020
…o-gitea#13470)

Fix go-gitea#12440
Closes go-gitea#13192

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
techknowlogick added a commit to techknowlogick/gitea that referenced this pull request Nov 10, 2020
…o-gitea#13470)

Fix go-gitea#12440
Closes go-gitea#13192

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
@zeripath zeripath deleted the fix-12440-prevent-panic-on-git-blame branch November 10, 2020 08:03
@zeripath zeripath mentioned this pull request Nov 10, 2020
7 tasks
@go-gitea go-gitea locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic in git blame

6 participants